package com.cskaoyan.controller.wx;

import com.cskaoyan.bean.BaseData;
import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.wxcollect.CollectInfo;
import com.cskaoyan.bean.wxcollect.CollectParam;
import com.cskaoyan.bean.wxcollect.bo.AddordeleteBO;
import com.cskaoyan.service.CollectService;
import com.cskaoyan.util.PageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.security.auth.Subject;
import java.util.List;

@RestController
@RequestMapping("wx/collect")
public class WXCollectController {


    @Autowired
    CollectService collectService;

    @RequestMapping("list")
    public BaseRespVo list(CollectParam param) {
        BaseData<CollectInfo> data = collectService.list(param);
        return BaseRespVo.ok(data);
    }

    @PostMapping("addordelete")
    public BaseRespVo addordelete(@RequestBody AddordeleteBO bo) {
         int num = collectService.addordelete(bo);
         if (num !=0 ){
             return BaseRespVo.ok();
         }else return BaseRespVo.fail("收藏失败");
    }


}
